<template>
	<view>
		<u-navbar :title="pageInfos.title" @leftClick="leftClick" :autoback="true"></u-navbar>
		<view class="page-padding">
			<view class="flex heada">
				<view class="line"></view>
				<text class="title">{{pageInfos.pageTitle}}</text>
			</view>
			<view class="des">{{pageInfos.pageDes}}</view>
			<view class="flex-row space-x-12">
			  <image
			    class="image"
			    src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16668710363872637907.png"
			  />
			  <text class="font_1 text" @click="phone">服务热线：15755387045</text>
			</view>
			<view class="flex-row space-x-11 group">
			  <image
			    class="image_2"
			    src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/632afc43e391320011695f3b/16668710363923730652.png"
			  />
			  <text class="font_1 text_2">您的需求描述</text>
			</view>
			<view class="textarea">
				<u--textarea v-model="content" :placeholder="pageInfos.placeholder" height="255"  confirmType="done"></u--textarea>
			</view>
		</view>
		<view class="button-foot">
			<u-button type="primary" @click="submit">提交</u-button>
		</view>
	</view>
</template>

<script>
	import {feedBack} from '@/api/index.js'
	export default {
		data() {
			return {
				pageInfos:{},
				infos:{
					'demand':{
						title:'发布需求',
						pageTitle:'发布需求',
						pageDes:"您可以再这里发布买专利、买专利、查专利、管理专利等需求~~",
						placeholder:'请简要描述您的需发布的需求...'
					},
					'link':{
						title:'立即联系',
						pageTitle:'联系我们',
						pageDes:"为更好的为您服务，请填写下方信息，收到您的留言后，我们会尽快给您回复，感谢配合。",
						placeholder:'请简要描述您的需求...'
					}
				},
				content:''
			};
		},
		onLoad(option) {
			this.pageInfos = this.infos[option.info || 'demand'];
			this.content = '';
		},
		methods:{
			leftClick(){
				if (getCurrentPages().length > 1) {
					uni.navigateBack();
				} else {
					uni.switchTab({
						url: '../../pages/index/index'
					})
				}
			},
			
			submit(){
				feedBack({name:this.$userInfo().phone || '',feedbackContent:this.content,concat:this.$userInfo().phone || ''}).then(res => {
					if(res.code === 200) {
						this.$u.toast('操作成功')
					}
				})
			},
			phone(){
				uni.makePhoneCall({
					phoneNumber: '15755387045' //仅为示例
				});
			}
		}
	}
</script>

<style lang="scss">
.line {
	width: 12rpx;
	height: 40rpx;
	background-color: #409eff;
	margin-right: 10rpx;
	margin-top: 6rpx;
}
.heada {
	padding-bottom: 16rpx;
	border-bottom: 20rpx solid #f6f4f8;
}
.title {
	font-size: 32rpx;
	color: $uni-color-top;
}

.des {
	margin-top: 38rpx;
	margin-bottom: 30rpx;
	font-size: 28rpx;
	color: $uni-color-middle;
}

.des-1 {
	font-size: 28rpx;
	color: #37c637;
	margin-bottom: 30rpx;
}

.des-2 {
	font-size: 28rpx;
	color: $uni-color-top;
}

.textarea {
	margin-top: 20rpx;
	padding: 0 10rpx;
}

.button-foot {
	width: 100%;
	position: fixed;
	bottom: 0;
}

.space-x-12 > view:not(:first-child),
.space-x-12 > text:not(:first-child),
.space-x-12 > image:not(:first-child) {
  margin-left: 12rpx;
}
.image {
  width: 33rpx;
  height: 29rpx;
}
.font_1 {
  font-size: 28rpx;
  font-family: Microsoft YaHei;
  line-height: 28rpx;
}
.text {
  color: #37c637;
}

.font_1 {
  font-size: 28rpx;
  font-family: Microsoft YaHei;
  line-height: 28rpx;
}
.group {
	margin-top: 30rpx;
  padding: 0 2rpx;
}
.space-x-11 > view:not(:first-child),
.space-x-11 > text:not(:first-child),
.space-x-11 > image:not(:first-child) {
  margin-left: 11rpx;
}
.image_2 {
  width: 28rpx;
  height: 28rpx;
}
.text_2 {
  color: #333333;
}
</style>
